<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> 
<head>
<%@ include file="../../include/easyui.jsp" %>
<%@ include file="../../include/pGrid.jsp" %>
<title>工程收入</title>
<script>
	function toPercent(point){
		point = point || 0;
	    if (point==0) { return 0; }
	    var str= Number(point*100).toFixed();
	    str+="%";
	    return str;
	}
	$(function(){
		var gridParam = {
			url:'/console/com.fs.jzzn.pojo.Income/list',
			sort:"createTime",
			order:"desc",
			queryParams:{
				rightControl: true
			},
			columns:[[
			          {field: "incomeNo", title: "单据编号", width: 120}
			    	  ,{field: "pNo", title: "订单编号", width: 120}
			    	  ,{field: "pContractTitle", title: "订单名称", width: 180}
			    	  
			    	 ,{field: "money",title: "回款金额(元)", width: 100,formatter:function(value,row,index){
			    		 return parseFloat(value||0).toLocaleString();
			    	 }}
			    	 ,{field: "incomeRate",title: "回款比例", width: 80,formatter: function(value,row,index){
			    		 return toPercent(value);
			    	 }}
			    	 ,{field: "incomeType",title: "回款类型", width: 80}
			    	 ,{field: "returnedDate", "title": "回款日期", width: 120}
			    	 ,{field: "verifyUserName", title: "回款确认人", width: 120}
			    	 ,{field: "companyName", title: "对方户名", width: 250}
			    	 ,{field: "billsNo",title: "凭单号", width: 120}
			    	 ,{field: 'orgNo', title: '所属机构', width: 180,formatter: function(value,row,index){
							return (value || '') + '-' + (row.orgNoName|| '') ;
					 }}
			    	// ,{field : "department",width : 120,title: "关联项目部"}
					,{field : "remark",width : 150,title: "备注"}
					,{field : "createTime",width : 130,title: "创建时间"}
					,{field : "createrName",width : 130,title: "创建人"}
			]],
			onLoadSuccess: function(){
				p.tooltip([ 'companyName', 'billsNo', 'remark','pContractTitle','pNo'  ]);
			}
		};
		p.dataGrid = $(p.dataGrid).datagrid($.extend({}, p.dataGridParam,gridParam));
		/*事件响应*/
		$("#toolbar .easyui-linkbutton").on("click", function() {
			var motion_code = $(this).attr("motion_code");p.btnOneClick($(this));
			switch (motion_code) {
				case "01":
					p.gridAdd({title : "收入新增" ,width : 650, height : 470 ,autoMax:true});
					break;
				case "02":
					p.gridModify({title : "收入编辑" ,width : 650, height : 470 ,autoMax:true});
					break;
				case "03":
					p.gridDelete({ msg:"您确认删除当前选中收入记录？" });
					break;
				case "04":
					p.gridView({title : "收入查看" ,width : 650, height : 470 ,autoMax:true});
					break;
				case "05":
					p.gridQuery();
					break;
				case "07":
					p.down({filename:'工程收入'});
					break;
				case "19":
					p.gridAdd({href:'/console/income/import', title : "工程收入数据导入", width : 550, height : 330 });
					break;
				default:
					break;
				}
		});
	});
</script>
</head>
<body class="easyui-layout">
	<!-- 但行高度33px，多行时 33乘以行数  -->
	<div data-options="region:'north',split:false,border:false" style="auto;">
		<div class="easyui-panel" data-options="fit:true,border:false">
			<!-- 查询条件表单，根据配置进行替换  -->
		<form id="queryForm" >
		 <input type="hidden" name="className" value="com.fs.jzzn.pojo.Income" />
		 <div style="margin-top:5px;margin-left:10px;float:left;">
		  	<input class="easyui-textbox" name="incomeNo" style="width:240px;" data-options="label:'单据编号:',required:false" />
			<input type="hidden" name="incomeNo_searchType" value="like" />
		 </div>
		 <div style="margin-top:5px;margin-left:10px;float:left;">
		  	<input class="easyui-textbox" name="pNo" style="width:240px;" data-options="label:'订单编号:',required:false" />
			<input type="hidden" name="pNo_searchType" value="like" />
		 </div>
		 <div style="margin-top:5px;margin-left:10px;float:left;">
		  	<input class="easyui-textbox" name="companyName" style="width:240px;" data-options="label:'对方户名:',required:false" />
			<input type="hidden" name="companyName_searchType" value="like" />
		 </div>
		 
		 <div style="margin-top:5px;margin-left:10px;float:left;">
			  	<select class="easyui-combobox" name="incomeType" style="width:240px;" data-options="label:'回款类型:' ,labelWidth:65,prompt:'区域关键词' " 
					url="/console/combobox?valueField=dicName&textField=dicName&modleName=dictionary&pCode=C6&pCode_searchType=eq" >
			    </select>
				<input type="hidden" name="incomeType_searchType" value="like" />
			 </div>
			 
		<div style="margin-top:5px;margin-left:10px;float:left;">
		    	<select class="easyui-combotreegrid" name="orgNo" style="width:240px;" data-options="label:'所属机构:',panelWidth:250,
	           	idField: 'orgNo', 
	           	missingMessage:'必填项',
				treeField: 'orgName',
				sortName:'orgOrder',
				onSelect:function(row){
					$('input[name=department]').val(row.orgName);	    
				},
				sortOrder:'asc',
	            url:'/console/com.fs.base.pojo.Org/list', 
	            queryParams:{isTreeGrid:'true', treeId:'id', treePid:'parentId' },
	            columns:[[    
	                {field:'orgName',			width:190,	title:'组织名称' }
	            ]]"></select>
		  		<input type="hidden" name="orgNo_searchType" value="like" />
		 	</div>
		
		 <div style="margin-top:5px;margin-left:10px;float:left;">
		  	<input class="easyui-textbox" name="billsNo" style="width:240px;" data-options="label:'凭单号:',required:false" />
			<input type="hidden" name="billsNo_searchType" value="like" />
		 </div>
		 <div class="fItem">
	  		<input class="easyui-combobox" name="createrId" style="width:240px;" url="/console/combobox?valueField=id&textField=nickName&modleName=user" data-options="label:'创建人:',required:false" />
	  		<input type="hidden" name="createrId_searchType" value="eq" />
	 	</div>
	 	
	 	<div class="fItem">
		 	<input class="easyui-datebox" style="width:240px;" name="createTime" data-options="label:'开始日期:',required:false" />
		 	<input type="hidden" name="createTime_searchType" value="between" />
		 	<input type="hidden" name="createTime_format" value="date" />
		</div>
		<div class="fItem">
		 	<input class="easyui-datebox" style="width:240px;" name="createTime" data-options="label:'截至日期:',required:false" />
		</div>
		 
		</form>
		</div>
	</div> 
	<!-- 工具栏按钮 -->
	<div id="toolbar" class="easyui-panel" style="padding:3px;">
	</div>
	
	<!-- 表格 -->
	<div region="center" border="false">
		<table id="dataGrid"></table>
	</div>
</body>
</html>